/**
 *    Copyright (C) 2008, 2009  Victor Smirnov <aist11@gmail.com>
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *    See LICENSE.exceptions in the root folder of this project for possible
 *    exceptions
 *
 */

#ifndef _CUBEFS_API_REFLECTION_TYPE_HASH_HPP
#define	_CUBEFS_API_REFLECTION_TYPE_HASH_HPP

#include <cubefs/api/types.hpp>

namespace cubefs    {
namespace api       {

template <typename T> struct TypeHash;

#define CUBEFS_DEFINE_TYPE_HASH(TypeName, Value)	\
template <>											\
struct TypeHash<TypeName> {							\
	static const Int hash = Value;					\
}

CUBEFS_DEFINE_TYPE_HASH(Byte, 			1);
CUBEFS_DEFINE_TYPE_HASH(UByte, 			2);
CUBEFS_DEFINE_TYPE_HASH(Short, 			3);
CUBEFS_DEFINE_TYPE_HASH(UShort, 		4);
CUBEFS_DEFINE_TYPE_HASH(Int, 			5);
CUBEFS_DEFINE_TYPE_HASH(UInt, 			6);
CUBEFS_DEFINE_TYPE_HASH(Long, 			7);
CUBEFS_DEFINE_TYPE_HASH(BigInt, 		8);
CUBEFS_DEFINE_TYPE_HASH(float, 			9);
CUBEFS_DEFINE_TYPE_HASH(double, 		10);

CUBEFS_DEFINE_TYPE_HASH(bool, 			11);
CUBEFS_DEFINE_TYPE_HASH(void*, 			12);
CUBEFS_DEFINE_TYPE_HASH(const void*, 	13);
CUBEFS_DEFINE_TYPE_HASH(String, 		14);
CUBEFS_DEFINE_TYPE_HASH(StringRef, 		15);
CUBEFS_DEFINE_TYPE_HASH(const String, 	16);

struct Typed;
struct Type;

template <typename T>
struct TypedValue;

CUBEFS_DEFINE_TYPE_HASH(Typed*, 				17);
CUBEFS_DEFINE_TYPE_HASH(Type*, 					18);
CUBEFS_DEFINE_TYPE_HASH(TypedValue<String>*, 	19);

}
}

#endif /* TYPE_HASH_HPP_ */
